package drds.binlog.protocol.entry_protocol_proto;

/**
 * <pre>
 * *预留扩展*
 * </pre>
 * <p>
 * Protobuf type {@code com.alibaba.otter.canal.protocol.Pair}
 */
public final class Pair extends
        com.google.protobuf.GeneratedMessageV3 implements
        // @@protoc_insertion_point(message_implements:com.alibaba.otter.canal.protocol.Pair)
        PairOrBuilder
{
    public static final int KEY_FIELD_NUMBER = 1;
    public static final int VALUE_FIELD_NUMBER = 2;
    private static final long serialVersionUID = 0L;
    // @@protoc_insertion_point(class_scope:com.alibaba.otter.canal.protocol.Pair)
    private static final Pair DEFAULT_INSTANCE;
    private static final com.google.protobuf.Parser<Pair>
            PARSER = new com.google.protobuf.AbstractParser<Pair>()
    {
        @Override
        public Pair parsePartialFrom(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws com.google.protobuf.InvalidProtocolBufferException
        {
            return new Pair(input, extensionRegistry);
        }
    };

    static
    {
        DEFAULT_INSTANCE = new Pair();
    }

    private volatile Object key_;
    private volatile Object value_;
    private byte memoizedIsInitialized = -1;

    // Use Pair.newBuilder() to construct.
    private Pair(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)
    {
        super(builder);
    }

    private Pair()
    {
        key_ = "";
        value_ = "";
    }

    private Pair(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        this();
        if (extensionRegistry == null)
        {
            throw new NullPointerException();
        }
        int mutable_bitField0_ = 0;
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
                com.google.protobuf.UnknownFieldSet.newBuilder();
        try
        {
            boolean done = false;
            while (!done)
            {
                int tag = input.readTag();
                switch (tag)
                {
                    case 0:
                        done = true;
                        break;
                    case 10:
                    {
                        String s = input.readStringRequireUtf8();

                        key_ = s;
                        break;
                    }
                    case 18:
                    {
                        String s = input.readStringRequireUtf8();

                        value_ = s;
                        break;
                    }
                    default:
                    {
                        if (!parseUnknownFieldProto3(
                                input, unknownFields, extensionRegistry, tag))
                        {
                            done = true;
                        }
                        break;
                    }
                }
            }
        } catch (com.google.protobuf.InvalidProtocolBufferException e)
        {
            throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e)
        {
            throw new com.google.protobuf.InvalidProtocolBufferException(
                    e).setUnfinishedMessage(this);
        } finally
        {
            this.unknownFields = unknownFields.build();
            makeExtensionsImmutable();
        }
    }

    public static final com.google.protobuf.Descriptors.Descriptor
    getDescriptor()
    {
        return BinlogEntry.protocol_Pair_descriptor;
    }

    public static Pair parseFrom(
            java.nio.ByteBuffer data)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data);
    }

    public static Pair parseFrom(
            java.nio.ByteBuffer data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Pair parseFrom(
            com.google.protobuf.ByteString data)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data);
    }

    public static Pair parseFrom(
            com.google.protobuf.ByteString data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Pair parseFrom(byte[] data)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data);
    }

    public static Pair parseFrom(
            byte[] data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException
    {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static Pair parseFrom(java.io.InputStream input)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input);
    }

    public static Pair parseFrom(
            java.io.InputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static Pair parseDelimitedFrom(java.io.InputStream input)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseDelimitedWithIOException(PARSER, input);
    }

    public static Pair parseDelimitedFrom(
            java.io.InputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }

    public static Pair parseFrom(
            com.google.protobuf.CodedInputStream input)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input);
    }

    public static Pair parseFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException
    {
        return com.google.protobuf.GeneratedMessageV3
                .parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static Builder newBuilder()
    {
        return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(Pair prototype)
    {
        return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    public static Pair getDefaultInstance()
    {
        return DEFAULT_INSTANCE;
    }

    public static com.google.protobuf.Parser<Pair> parser()
    {
        return PARSER;
    }

    @Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields()
    {
        return this.unknownFields;
    }

    @Override
    protected FieldAccessorTable
    internalGetFieldAccessorTable()
    {
        return BinlogEntry.protocol_Pair_fieldAccessorTable
                .ensureFieldAccessorsInitialized(
                        Pair.class, Builder.class);
    }

    /**
     * <code>string key = 1;</code>
     */
    public String getKey()
    {
        Object ref = key_;
        if (ref instanceof String)
        {
            return (String) ref;
        } else
        {
            com.google.protobuf.ByteString bs =
                    (com.google.protobuf.ByteString) ref;
            String s = bs.toStringUtf8();
            key_ = s;
            return s;
        }
    }

    /**
     * <code>string key = 1;</code>
     */
    public com.google.protobuf.ByteString
    getKeyBytes()
    {
        Object ref = key_;
        if (ref instanceof String)
        {
            com.google.protobuf.ByteString b =
                    com.google.protobuf.ByteString.copyFromUtf8(
                            (String) ref);
            key_ = b;
            return b;
        } else
        {
            return (com.google.protobuf.ByteString) ref;
        }
    }

    /**
     * <code>string value = 2;</code>
     */
    public String getValue()
    {
        Object ref = value_;
        if (ref instanceof String)
        {
            return (String) ref;
        } else
        {
            com.google.protobuf.ByteString bs =
                    (com.google.protobuf.ByteString) ref;
            String s = bs.toStringUtf8();
            value_ = s;
            return s;
        }
    }

    /**
     * <code>string value = 2;</code>
     */
    public com.google.protobuf.ByteString
    getValueBytes()
    {
        Object ref = value_;
        if (ref instanceof String)
        {
            com.google.protobuf.ByteString b =
                    com.google.protobuf.ByteString.copyFromUtf8(
                            (String) ref);
            value_ = b;
            return b;
        } else
        {
            return (com.google.protobuf.ByteString) ref;
        }
    }

    @Override
    public final boolean isInitialized()
    {
        byte isInitialized = memoizedIsInitialized;
        if (isInitialized == 1) return true;
        if (isInitialized == 0) return false;

        memoizedIsInitialized = 1;
        return true;
    }

    @Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
            throws java.io.IOException
    {
        if (!getKeyBytes().isEmpty())
        {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_);
        }
        if (!getValueBytes().isEmpty())
        {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_);
        }
        unknownFields.writeTo(output);
    }

    @Override
    public int getSerializedSize()
    {
        int size = memoizedSize;
        if (size != -1) return size;

        size = 0;
        if (!getKeyBytes().isEmpty())
        {
            size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_);
        }
        if (!getValueBytes().isEmpty())
        {
            size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_);
        }
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
    }

    @Override
    public boolean equals(final Object obj)
    {
        if (obj == this)
        {
            return true;
        }
        if (!(obj instanceof Pair))
        {
            return super.equals(obj);
        }
        Pair other = (Pair) obj;

        boolean result = true;
        result = result && getKey()
                .equals(other.getKey());
        result = result && getValue()
                .equals(other.getValue());
        result = result && unknownFields.equals(other.unknownFields);
        return result;
    }

    @Override
    public int hashCode()
    {
        if (memoizedHashCode != 0)
        {
            return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        hash = (37 * hash) + KEY_FIELD_NUMBER;
        hash = (53 * hash) + getKey().hashCode();
        hash = (37 * hash) + VALUE_FIELD_NUMBER;
        hash = (53 * hash) + getValue().hashCode();
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
    }

    @Override
    public Builder newBuilderForType()
    {
        return newBuilder();
    }

    @Override
    public Builder toBuilder()
    {
        return this == DEFAULT_INSTANCE
                ? new Builder() : new Builder().mergeFrom(this);
    }

    @Override
    protected Builder newBuilderForType(
            BuilderParent parent)
    {
        Builder builder = new Builder(parent);
        return builder;
    }

    @Override
    public com.google.protobuf.Parser<Pair> getParserForType()
    {
        return PARSER;
    }

    @Override
    public Pair getDefaultInstanceForType()
    {
        return DEFAULT_INSTANCE;
    }

    /**
     * <pre>
     * *预留扩展*
     * </pre>
     * <p>
     * Protobuf type {@code com.alibaba.otter.canal.protocol.Pair}
     */
    public static final class Builder extends
            com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
            // @@protoc_insertion_point(builder_implements:com.alibaba.otter.canal.protocol.Pair)
            PairOrBuilder
    {
        private Object key_ = "";
        private Object value_ = "";

        // Construct using BinlogEntry.Pair.newBuilder()
        private Builder()
        {
            maybeForceBuilderInitialization();
        }

        private Builder(
                BuilderParent parent)
        {
            super(parent);
            maybeForceBuilderInitialization();
        }

        public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor()
        {
            return BinlogEntry.protocol_Pair_descriptor;
        }

        @Override
        protected FieldAccessorTable
        internalGetFieldAccessorTable()
        {
            return BinlogEntry.protocol_Pair_fieldAccessorTable
                    .ensureFieldAccessorsInitialized(
                            Pair.class, Builder.class);
        }

        private void maybeForceBuilderInitialization()
        {
            if (com.google.protobuf.GeneratedMessageV3
                    .alwaysUseFieldBuilders)
            {
            }
        }

        @Override
        public Builder clear()
        {
            super.clear();
            key_ = "";

            value_ = "";

            return this;
        }

        @Override
        public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType()
        {
            return BinlogEntry.protocol_Pair_descriptor;
        }

        @Override
        public Pair getDefaultInstanceForType()
        {
            return Pair.getDefaultInstance();
        }

        @Override
        public Pair build()
        {
            Pair result = buildPartial();
            if (!result.isInitialized())
            {
                throw newUninitializedMessageException(result);
            }
            return result;
        }

        @Override
        public Pair buildPartial()
        {
            Pair result = new Pair(this);
            result.key_ = key_;
            result.value_ = value_;
            onBuilt();
            return result;
        }

        @Override
        public Builder clone()
        {
            return (Builder) super.clone();
        }

        @Override
        public Builder setField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                Object value)
        {
            return (Builder) super.setField(field, value);
        }

        @Override
        public Builder clearField(
                com.google.protobuf.Descriptors.FieldDescriptor field)
        {
            return (Builder) super.clearField(field);
        }

        @Override
        public Builder clearOneof(
                com.google.protobuf.Descriptors.OneofDescriptor oneof)
        {
            return (Builder) super.clearOneof(oneof);
        }

        @Override
        public Builder setRepeatedField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                int index, Object value)
        {
            return (Builder) super.setRepeatedField(field, index, value);
        }

        @Override
        public Builder addRepeatedField(
                com.google.protobuf.Descriptors.FieldDescriptor field,
                Object value)
        {
            return (Builder) super.addRepeatedField(field, value);
        }

        @Override
        public Builder mergeFrom(com.google.protobuf.Message other)
        {
            if (other instanceof Pair)
            {
                return mergeFrom((Pair) other);
            } else
            {
                super.mergeFrom(other);
                return this;
            }
        }

        public Builder mergeFrom(Pair other)
        {
            if (other == Pair.getDefaultInstance()) return this;
            if (!other.getKey().isEmpty())
            {
                key_ = other.key_;
                onChanged();
            }
            if (!other.getValue().isEmpty())
            {
                value_ = other.value_;
                onChanged();
            }
            this.mergeUnknownFields(other.unknownFields);
            onChanged();
            return this;
        }

        @Override
        public final boolean isInitialized()
        {
            return true;
        }

        @Override
        public Builder mergeFrom(
                com.google.protobuf.CodedInputStream input,
                com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                throws java.io.IOException
        {
            Pair parsedMessage = null;
            try
            {
                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e)
            {
                parsedMessage = (Pair) e.getUnfinishedMessage();
                throw e.unwrapIOException();
            } finally
            {
                if (parsedMessage != null)
                {
                    mergeFrom(parsedMessage);
                }
            }
            return this;
        }

        /**
         * <code>string key = 1;</code>
         */
        public String getKey()
        {
            Object ref = key_;
            if (!(ref instanceof String))
            {
                com.google.protobuf.ByteString bs =
                        (com.google.protobuf.ByteString) ref;
                String s = bs.toStringUtf8();
                key_ = s;
                return s;
            } else
            {
                return (String) ref;
            }
        }

        /**
         * <code>string key = 1;</code>
         */
        public Builder setKey(
                String value)
        {
            if (value == null)
            {
                throw new NullPointerException();
            }

            key_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string key = 1;</code>
         */
        public com.google.protobuf.ByteString
        getKeyBytes()
        {
            Object ref = key_;
            if (ref instanceof String)
            {
                com.google.protobuf.ByteString b =
                        com.google.protobuf.ByteString.copyFromUtf8(
                                (String) ref);
                key_ = b;
                return b;
            } else
            {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        /**
         * <code>string key = 1;</code>
         */
        public Builder setKeyBytes(
                com.google.protobuf.ByteString value)
        {
            if (value == null)
            {
                throw new NullPointerException();
            }
            checkByteStringIsUtf8(value);

            key_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string key = 1;</code>
         */
        public Builder clearKey()
        {

            key_ = getDefaultInstance().getKey();
            onChanged();
            return this;
        }

        /**
         * <code>string value = 2;</code>
         */
        public String getValue()
        {
            Object ref = value_;
            if (!(ref instanceof String))
            {
                com.google.protobuf.ByteString bs =
                        (com.google.protobuf.ByteString) ref;
                String s = bs.toStringUtf8();
                value_ = s;
                return s;
            } else
            {
                return (String) ref;
            }
        }

        /**
         * <code>string value = 2;</code>
         */
        public Builder setValue(
                String value)
        {
            if (value == null)
            {
                throw new NullPointerException();
            }

            value_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string value = 2;</code>
         */
        public com.google.protobuf.ByteString
        getValueBytes()
        {
            Object ref = value_;
            if (ref instanceof String)
            {
                com.google.protobuf.ByteString b =
                        com.google.protobuf.ByteString.copyFromUtf8(
                                (String) ref);
                value_ = b;
                return b;
            } else
            {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        /**
         * <code>string value = 2;</code>
         */
        public Builder setValueBytes(
                com.google.protobuf.ByteString value)
        {
            if (value == null)
            {
                throw new NullPointerException();
            }
            checkByteStringIsUtf8(value);

            value_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string value = 2;</code>
         */
        public Builder clearValue()
        {

            value_ = getDefaultInstance().getValue();
            onChanged();
            return this;
        }

        @Override
        public final Builder setUnknownFields(
                final com.google.protobuf.UnknownFieldSet unknownFields)
        {
            return super.setUnknownFieldsProto3(unknownFields);
        }

        @Override
        public final Builder mergeUnknownFields(
                final com.google.protobuf.UnknownFieldSet unknownFields)
        {
            return super.mergeUnknownFields(unknownFields);
        }


        // @@protoc_insertion_point(builder_scope:com.alibaba.otter.canal.protocol.Pair)
    }

}
